﻿using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;

namespace AdminBase.Model
{
    /// <summary>
    /// 分页基础字段
    /// </summary>
    public class PageBase
    {
        /// <summary>
        /// 第几页
        /// </summary>
        [FromQuery(Name = "page")]
        [JsonProperty("page")]
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页数量
        /// </summary>
        [FromQuery(Name = "size")]
        [JsonProperty("size")]
        public int PageSize { get; set; } = 10;

        /// <summary>
        /// 排序字段
        /// </summary>
        [FromQuery(Name = "sortField")]
        [JsonProperty("sortField")]
        public string? SortField { get; set; }

        /// <summary>
        /// 是否正序
        /// </summary>
        [FromQuery(Name = "ascending")]
        [JsonProperty("ascending")]
        public bool Ascending { get; set; }
    }
}
